<!--[if IE]>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<![endif]-->
<html>
<head lang="zh-cn">
    <title>应用圈远程安装PC端</title>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">
    <script type="text/javascript">
        var phoneScale = parseInt(window.screen.width)/720;
        document.write('<meta name="viewport" content="width=720, minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
    </script>
    <link rel="stylesheet" type="text/css" href="css/pc.css">
    <script type="text/javascript" src="libs/jquery.js"></script>
    <script type="text/javascript" src="libs/center.js"></script>
    <script type="text/javascript" src="libs/jquery.krakatoa.js"></script>
    <script type="text/javascript" src="libs/jquery-ui.js"></script>
    <script type="text/javascript" src="js/dropzone.js"></script>
    <script type="text/javascript" src="js/pc.js"></script>
    <script type="text/javascript" src="js/webdata.js"></script>
    <script type="text/javascript" src="js/jsonparse.js"></script>
    <script type="text/javascript">
$(document).ready(function(e) {

	$("#selectimg").dropzone({
		url: '/servlet/superx/app/pushapk',
		paramName: "fileName", // The name that will be used to transfer the file
		maxFiles: 10,
		maxFilesize: 512,
		acceptedFiles: ".apk",
		clickable: false,
		dictDefaultMessage: "点击上传，或者拖拽文件到这里",
		dictFallbackMessage: "",
		dictFallbackText: "",
		dictMaxFilesExceeded: "您一次最多只能上传{{maxFiles}}个文件",
		dictFileTooBig: "文件太大了 ({{filesize}}MB). 允许的最大文件大小: {{maxFilesize}}MB.",
		dictInvalidFileType: "你不能上传这个类型的文件.",
		dictResponseError: "服务器响应错误，代码：{{statusCode}} .",
		dictCancelUpload: "取消上传",
		dictCancelUploadConfirmation: "你确定要取消这次上传?",
		dictRemoveFile: "移除文件",
		forceFallback: false,
		uploadMultiple: false,
		init: function() {
		    this.on("dragenter", function(file) {
		        var element = document.getElementById("selectimg");
		        element.src = "pc_images/selected.png";
		    });

		    this.on("dragleave", function(file) {
                var element = document.getElementById("selectimg");
		        element.src = "pc_images/selecting.png";
		    });

		    this.on("dragend", function(file) {
                alert("dragend");
		    });

            this.on("success", function(file) {
                //显示正在安装, 会出现上传成功了而没有回调情况
                var element = document.getElementById("progress");
                if(element.innerHTML != "安装中") {
                    element.innerHTML = "安装中";
                    //调用接口通知服务器文件上传成功，在通知接口中等待返回结果 file.name
                    alert("dropzone getapkinfo");
                    getapkinfo(file.name);
                }

                <!--setTimeout( function(){-->
                         <!--serverResult = new uploadServerResult(0, "安装成功");-->
                <!--} , 3000);-->
             });

            this.on("removedfile", function(file) {
                <!--alert("removedfile");-->
            });

            this.on("addedfile", function(file) {
                var element = document.getElementById("selectimg");
		        element.src = "pc_images/selecting.png";
                uploadFileName = file.name;
				startUploadFile();
        	});

        	 this.on("uploadprogress", function(file, progress) {
				 <!--alert("上传文件。。。"+progress);-->
				 uploadProgress = Math.round(progress);
        	});

            /*出错时. 接受 errorMessage 作为第二个参数，并且如果错误是 XMLHttpRequest对象， 那就作为第三个参数.*/
        	this.on("error", function(file, errorMessage) {
				 <!--alert("出错了！ "+errorMessage+", statusCode = "+"{{statusCode}}");-->
				 //上传失败时调用uploaderror() 返回初始界面
				 <!--uploaderror();-->
        	});
        }
	});

        <!--没找到什么好方法先这么来吧-->
       $("#inputbtn").dropzone({
		url: '/servlet/superx/app/pushapk',
		paramName: "fileName", // The name that will be used to transfer the file
		maxFiles: 10,
		maxFilesize: 512,
		acceptedFiles: ".apk",
		dictDefaultMessage: "点击上传，或者拖拽文件到这里",
		dictFallbackMessage: "",
		dictFallbackText: "",
		dictFileTooBig: "文件太大了 ({{filesize}}MB). 允许的最大文件大小: {{maxFilesize}}MB.",
		dictInvalidFileType: "你不能上传这个类型的文件.",
		dictResponseError: "服务器响应错误，代码：{{statusCode}} .",
		dictCancelUpload: "取消上传",
		dictCancelUploadConfirmation: "你确定要取消这次上传?",
		dictRemoveFile: "移除文件",
		forceFallback: false,
		uploadMultiple: false,
		init: function() {
            this.on("success", function(file) {
                //显示正在安装, 会出现上传成功了而没有回调情况
                var element = document.getElementById("progress");
                if(element.innerHTML != "安装中") {
                    element.innerHTML = "安装中";
                    //调用接口通知服务器文件上传成功，在通知接口中等待返回结果 file.name
                    <!--alert("dropzone getapkinfo");-->
                    getapkinfo(file.name);
                }

                <!--setTimeout( function(){-->
                         <!--serverResult = new uploadServerResult(0, "安装成功");-->
                <!--} , 3000);-->
             });

            this.on("removedfile", function(file) {
                <!--alert("removedfile");-->
            });

            this.on("addedfile", function(file) {
                 uploadFileName = file.name;
				 startUploadFile();
        	});

        	 this.on("uploadprogress", function(file, progress) {
				 <!--alert("上传文件。。。"+progress);-->
				 uploadProgress = Math.round(progress);
        	});

            /*出错时. 接受 errorMessage 作为第二个参数，并且如果错误是 XMLHttpRequest对象， 那就作为第三个参数.*/
        	this.on("error", function(file, errorMessage) {
				 <!--alert("出错了！ "+errorMessage+", statusCode = "+"{{statusCode}}");-->
				 //上传失败时调用uploaderror() 返回初始界面
				 <!--uploaderror();-->
        	});
        }
	});
});
    </script>
</head>
<body>

<header id="header">
    <div id="adver">
        <img src="pc_images/coocaa_logo.png" alt=""/>
    </div>
</header>

<div id="selected">
    <img id="selectimg" src="pc_images/selecting.png">
    <p id="selectInfo">点击上传文件或拖曳文件至虚线框内</p>
    <p id="selectOnlyOne">＊每次只能添加一个</p>
</div>

<div id="uploadarea">
    <div id="upload1" class="upload">
        <!--<form action="" method="post" enctype="multipart/form-data">-->
            <p type="button"  id="inputbtn" class="btn" onMouseOver=btnOnMouseOver() onMouseOut=btnOnMouseOut()
               onMouseDown=btnOnMouseDown() onMouseUp=btnOnMouseUp() >上传文件 </p>
            <!--<input type="file" name="fileField" class="file" id="fileField" size="28"-->
                    <!--accept=".apk"/>-->
        <!--</form>-->
    </div>
</div>
<div id="loadingarea">
    <div id="loadingimg">
        <div id="rotate" width="92px" height="92px" style=" position:absolute;">
            <img src="pc_images/loading.png"/>
        </div>
        <p id="progress" class="progress">发送中</p>
    </div>
    <p id="loadmsg" class="loadmsg">正在发送安装包到电视</p>
</div>

<div id="updatesuccess">
    <div style="width: 2rem;margin: 0 auto;color: #484848;font-size: .3rem;text-align: center;margin-bottom: .64rem;">
        上传成功！
    </div>
    <div>
        <figure id="updatesuccessfigure">
            <img id="appimg" src="pc_images/youku.png" alt="">
            <figcaption>
                <hgroup>
                    <h2 id="appName" class="appName">优酷</h2>

                    <h3 id="appversion" class="appversion">软件版本</h3>

                    <h3 id="appinfo" class="appinfo">软件大小</h3>
                </hgroup>
            </figcaption>
        </figure>
    </div>
    <div id="upload2" class="upload" style="margin-top: 1.1rem;">
        <form action="" method="post" enctype="multipart/form-data">
            <!--<input type="button" id="inputbtn2" class="btn" value="再传一个" onclick=uploadAgain() />-->
            <p  id="inputbtn2" class="btn" onclick=uploadAgain() onMouseOver=btnOnMouseOver() onMouseOut=btnOnMouseOut()
                onMouseDown=btnOnMouseDown() onMouseUp=btnOnMouseUp() >再传一个 </p>
            <!--<input type="file" name="fileField2" class="file" id="fileField2" size="28"-->
                   <!--onchange=getfilename(this.value) accept=".apk"/>-->
        </form>
    </div>
</div>
</body>
<script type="text/javascript">
	$(document).ready(function(){
		getIpAddress();
	});
	</script>
</html>